home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / cuj9205.zip / 1005094A < prev    next >
Text File  |  1992-06-02  |  311b  |  22 lines

  1.  
  2. Listing 6
  3.  
  4. class rational
  5.     {
  6. public:
  7.     rational() : num(0), denom(1) { }
  8.     ...
  9.     friend ostream &operator<<(ostream &, rational)
  10. private:
  11.     long num, denom;
  12.     void simplify();
  13.     };
  14.  
  15. ...
  16.  
  17. ostream &operator<<(ostream &os, rational r)
  18.     {
  19.     os  << '(' << r.num << '/' << r.denom << ')';
  20.     }
  21.  
  22.